/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfonia.model.elements;

import org.jfonia.connect5.basics.BasicValueNode;
import org.jfonia.connect5.basics.MutableValueNode;

/**
 *
 * @author Rik Bauwens
 */
public class TimeSignature extends MusicalElement implements IStaffElement
{
	private MutableValueNode<Integer> nominatorNode;
	private MutableValueNode<Integer> denominatorNode;

        public TimeSignature()
        {
                this(0);
        }

        public TimeSignature(int difference)
        {
                super(difference);
                //Default: 4/4
                nominatorNode = new BasicValueNode<Integer>(4);
                denominatorNode = new BasicValueNode<Integer>(4);
        }

        public MutableValueNode<Integer> getNominatorNode()
        {
                return nominatorNode;
        }

        public MutableValueNode<Integer> getDenominatorNode()
        {
                return denominatorNode;
        }

        public int getNominator()
        {
                return nominatorNode.getValue();
        }

        public int getDenominator()
        {
                return denominatorNode.getValue();
        }

        public TimeSignature setDenominator(int denominator)
        {
                denominatorNode.setValue(denominator);
                return this;
        }

        public TimeSignature setNominator(int nominator)
        {
                nominatorNode.setValue(nominator);
                return this;
        }

        @Override
        public TimeSignature clone(){
            TimeSignature ts = new TimeSignature(getDifference()).setNominator(getNominator())
                                                                 .setDenominator(getDenominator());
            return ts;
        }
}
